package ai.people.netmon.framework.domain.archives.entity;

import ai.people.netmon.utils.StringPool;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 组织关系
 * </p>
 *
 * @author zhenglin
 * @since 2022-06-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName(schema = "webservice", value = "gang_group_relation")
@NoArgsConstructor
public class GangGroupRelationBO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId
    private Long id;

    /**
     * 团伙ID
     */
    private Long gangGroupId;

    /**
     * 父节点ID
     */
    private Long parentId;

    /**
     * 团伙身份
     */
    private String groupIdentity;

    /**
     * 危险程度
     */
    private Integer degreeOfDanger;

    /**
     * 档案ID
     */
    private Long archivesId;

    /**
     * 档案名字
     */
    private String archivesName;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建时间
     */
    private Date updateTime;


    public String buildArchivesName() {
        if (StringUtils.isNotBlank(this.archivesName)) {
            return this.archivesName.split(StringPool.COMMA)[0];
        }
        return null;
    }
}
